﻿@model ProductOverviewModel
@using Nop.Web.Models.Catalog;
@{
    //prepare "Add to cart" AJAX link
    string addtocartlink = "";
    if (Model.ProductPrice.ForceRedirectionAfterAddingToCart)
    {
        addtocartlink = Url.RouteUrl("AddProductToCart", new { productId = Model.Id, forceredirection = Model.ProductPrice.ForceRedirectionAfterAddingToCart });
    }
    else
    {
        addtocartlink = Url.RouteUrl("AddProductToCart", new { productId = Model.Id });
    }
}
<div class="featured-product-box product-item col-xs-12" data-productid="@Model.Id">
    <div class="product-wrapper">
        <h2 class="page-title">Deal of the Day</h2>
        <div class="product-info-wrapper">
            <div class="col-ms-4 col-sm-4">
                <div class="product-image">
                <a href="@Url.RouteUrl("Product", new { SeName = Model.SeName })" title="@Model.DefaultPictureModel.Title">
                    <div class="image">
                        <div class="image-wrapper">
                            <img class="img-responsive" alt="@Model.DefaultPictureModel.AlternateText" src="@Model.DefaultPictureModel.ImageUrl" title="@Model.DefaultPictureModel.Title" />
                        </div>
                    </div>
                </a>
                </div>
            </div>
            <div class="col-ms-8 col-sm-8">
                <div class="info">
                    <div class="product-header">
                        <h3><a href="@Url.RouteUrl("Product", new { SeName = Model.SeName })" title="@Model.DefaultPictureModel.Title">@Model.Name</a></h3>
                        @if (Model.ProductReview != null && Model.ProductReview.RatingAverage >= 0)
                        {

                            @Html.Partial("_ProductReviewStars", new ProductReviewStarsModel()
                            {
                                ShowCount = false,
                                RatingPercent = (decimal)Model.ProductReview.RatingAverage * 100 / 5
                            })
                        }
                        else
                        {
                            @Html.Partial("_ProductReviewStars", new ProductReviewStarsModel()
                            {
                                ShowCount = false,
                                RatingPercent = 0
                            })
                        }
                    </div>
                    <div class="free-shipping-product-icon"></div>
                    <div class="prices-summary">
                        @if (!String.IsNullOrEmpty(Model.ProductPrice.MemberTierPrice) && Model.ProductPrice.IsMembeTier)
                        {
                            <span class="current">@Model.ProductPrice.MemberTierPrice</span>
                            <span class="regular">Regular: @Model.ProductPrice.Price</span><br />
                            <span class="save">You save: @Model.ProductPrice.SavePrice (@Model.ProductPrice.SavePercentage)</span>
                        }
                        else
                        {
                            <span class="current">@Model.ProductPrice.Price</span>
                            if (!String.IsNullOrEmpty(Model.ProductPrice.MemberTierPrice))
                            {
                                <span class="member">Club Member: @Model.ProductPrice.MemberTierPrice</span><br />
                                <span class="save">You could save: @Model.ProductPrice.SavePrice (@Model.ProductPrice.SavePercentage)</span>
                            }
                            if (!String.IsNullOrEmpty(Model.ProductPrice.OldPrice))
                            {
                                <span class="old">Was: @Model.ProductPrice.OldPrice</span>
                            }
                        }
                    </div>
                    @*<div class="shipping-message">FREE Shipping!</div>*@
                    <div class="description">
                        @Model.ShortDescription
                    </div>
                    <div class="tier-pricing-container">
                        @if (!String.IsNullOrEmpty(Model.ProductPrice.MemberTierPrice) && Model.ProductPrice.IsMembeTier)
                        {
                            <div class="tier-pricing-table text-center member-tier">
                                <div class="price-tier member">
                                    <div class="tier-name">Member</div>
                                    <div class="tier-price">@Model.ProductPrice.MemberTierPrice</div>
                                </div>
                                <div class="price-tier regular">
                                    <div class="tier-name">Regular</div>
                                    <div class="tier-price">@Model.ProductPrice.Price</div>
                                </div>
                            </div>
                        }
                        else
                        {
                            <div class="tier-pricing-table text-center">
                                <div class="price-tier regular">
                                    <div class="tier-name">Regular</div>
                                    <div class="tier-price">@Model.ProductPrice.Price</div>
                                </div>
                                @if (!String.IsNullOrEmpty(Model.ProductPrice.MemberTierPrice))
                                {
                                    <div class="price-tier member">
                                        <div class="tier-name">Member</div>
                                        <div class="tier-price">@Model.ProductPrice.MemberTierPrice</div>
                                    </div>
                                }

                            </div>
                        }
                        <div class="clear"></div>
                    </div>

                    <div class="clear"></div>
                    <div class="row">
                        <div class="col-xs-6">
                            <a class="btn btn-danger form-control add-to-cart" href="javascript:void(0)" onclick="AjaxCart.addproducttocart('@Url.RouteUrl("AddProductToCart", new { productId = Model.Id })', $('#product-details-form'), $(this));return false;">@T("ShoppingCart.AddtoCart")</a>
                            <div class="product-add-loading">
                                <img class="loading-gif" src="/content/images/loading.gif" />
                                <img class="loading-svg" src="/content/images/loading.svg" />
                            </div>
                        </div>
                        <div class="col-xs-6">
                            <a class="btn btn-info form-control more-information-button" href="@Url.RouteUrl("Product", new { SeName = Model.SeName })" title="@Model.DefaultPictureModel.Title">Full Details</a>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
            </div>
            <div class="clear"></div>
        </div>
    </div>
</div>